
<?php
	include("Connect/connection.php")
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/template.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<title>Eproject | Autocar</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/coin-slider.css" />
<script type="text/javascript" src="js/cufon-yui.js"></script>
<script type="text/javascript" src="js/cufon-georgia.js"></script>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript" src="js/coin-slider.min.js"></script>
<script>
	function SearchForm(f) {
				if(document.getElementsByName('txtSearch')[0].value=='') {
					document.getElementsByName('txtSearch')[0].focus();
            		return false;
				}
				return true;
		}
</script>
</head>

<body>
<?php
	if($_REQUEST['btnSearch']){
		$name=$_REQUEST['txtSearch'];
		$searchby=$_REQUEST['company'];
		if($_REQUEST['btnSearch']){
			echo("<script>window.location='searchresult.php?name=$name&&by=$searchby'</script>");										        }	
	}
?>
<div class="main">
  <div class="header">
    <div class="header_resize">
      <div class="menu_nav">
        <ul>
          <li><a href="Home.php"><span>Home Page</span></a></li>
          <li><a href="news.php"><span>News</span></a></li>
          <li><a href="cars.php"><span>Cars</span></a></li>
          <li><a href="companies.php"><span>Provider</span></a></li>
          <li><a href="contactus.php"><span>Contact Us</span></a></li>
        </ul>
        <div class="search">
        	<form name="searchForm" enctype="multipart/form-data" method="post" action="" >
                <input type="text" name="txtSearch" class="txtSearch" />
                <select name="company" class="cbbSearch">
                    <option value="0">By Name</option>
                    <option value="1">By Manufacturers</option>                        
                </select>
                <input type="submit" value="Search" name="btnSearch" class="btnSearch" />
            </form>
      	</div>
      </div>
      
      <div class="logo">
        <h1><a href="index.html">A<span>uto</span>Shop</a></h1>
        
      </div>
      
      <div class="clr"></div>
    </div>
  </div>
  <div class="content">
    <div class="content_resize"><!-- InstanceBeginEditable name="content" -->
      <div class="mainbar">
       
      <?php
					if(isset($_REQUEST["idCard"])){
						$idCar = $_REQUEST["idCard"];
						$perID= $_REQUEST["perID"];
						$query = mysql_query("select * from cars where CarID=$idCar");
						while($rs=mysql_fetch_array($query)){
							$title=$rs['Name'];
							$sub=$rs['Sumary'];
							$content=$rs['Content'];
							$image=$rs['Image'];
							$company=$rs['ComID'];
							$date=$rs['TimeProduction'];
							$price=$rs['Price'];
							?>
 			<div style="width:100%;height:50px;font:Arial, Helvetica, sans-serif;font-size:24px;font-weight:bold;"><p style="margin-left:20px;color:#603;line-height:50px;">Order </p></div>
            <div style="width:100%">
            <div><img style="width:300px;float:left" src="images/<?=$image ?> " /></div>
            <div style="margin-left:320px;border-bottom:1px solid #CCC" ><p style="font:'Arial Black', Gadget, sans-serif;font-size:18px;font-weight:bold"><?= $title ?></p></div>
            <div style="margin-left:320px;border-bottom:1px solid #CCC" ><p style="font:'Arial Black', Gadget, sans-serif;font-size:16px">Price : <?= $price ?></p></div>
            <div style="margin-left:320px;border-bottom:1px solid #CCC" ><p style="font:'Arial Black', Gadget, sans-serif;font-size:16px">Date of manufacture : <?= $date ?></p></div>
            <div style="margin-left:320px;border-bottom:1px solid #CCC" ><p style="font:'Arial Black', Gadget, sans-serif;font-size:16px">Sumary: <?= $sub ?></p></div>
             <?php
				$queryCom = mysql_query("select * from company where ComID=$company");
				while($rsCom=mysql_fetch_array($queryCom)){
					$comName=$rsCom['Name'];
			?>
            <div style="margin-left:320px;border-bottom:1px solid #CCC" ><p style="font:'Arial Black', Gadget, sans-serif;font-size:16px">Company: <?= $comName ?></p></div>
            <?php
				};
			?>
            </div>
            <form method="post" enctype="multipart/form-data">
        <table width="100%">
        <tr>
            <td width="100%">
                <textarea name="txtContent"  style="width:100%; height:300px;" ></textarea>
            </td>
        </tr>
     	<tr>
          	<td >
            	<input type="submit" name="btnSave"  id="btnSave" value="Order" />
            </td>
       </tr>
      </table>
      
       </form>
      
      	
      
        <?php 
			};
					}else{
        echo("<script>window.location='cars.php'</script>");
    }
				?>
     
      
      </div>
       <?php
							$content=$_REQUEST['txtContent'];
							if($_REQUEST['btnSave']){
								echo $idCar;
								echo $perID;
								echo $content;
							$sqlOrder="insert order(CarID,PerID,TimeOrder,Content,Status) 									 values('$idCar','$perID','2012','$content','0')";
							$resultOrder=mysql_query($sqlOrder);
							if($resultOrder>0){
										echo("<script>alert('Order success')</script>");
									}else{
										echo mysql_error();
										echo("<script>alert('Error')</script>");
									}
							}
													
							?>
      </div>
    <!-- InstanceEndEditable --><!-- InstanceBeginEditable name="rightmenu" -->
    <div class="sidebar">
      <div class="searchform"></div>
      <div class="clr"></div>
      <div class="gadget">
        <h2 class="star"><span>Sidebar</span> Menu</h2>
        <div class="clr"></div>
      </div>
      <div class="gadget">
        <h2 class="star"><span>Sponsors</span></h2>
        <div class="clr"></div>
        <ul class="ex_menu">
          <li></li>
        </ul>
      </div>
    </div>
    <!-- InstanceEndEditable -->
    <div class="clr"></div>
    </div>
  </div>
  <div class="fbg">
    <div class="fbg_resize">
    School: Hanoi-Aptech</br>
    Class: A0910G - Group 2</br>
    Project Name: AutoShop
      <div class="clr"></div>
    </div>
  </div>
  <div class="footer">
    <div class="footer_resize">
      <div style="clear:both;"></div>
    </div>
  </div>
</div>
</body>
<!-- InstanceEnd --></html>
